package com.yjq.yys.yhCalculate.enums;

/**
 * 符号枚举类
 * @author yjq
 */
public enum Symbol {

    /**
     * 符号枚举
     */
    Left("(",1), Right(")",2), Multiply("*",3), Divide("/",4), Plus("+",5), Minus("-",6),
    Multiply2("[*]",13), Divide2("[/]",14), Plus2("[+]",15), Minus2("[-]",16);

    private String name;
    private int index;

    /**
     * 构造方法
     * @param name 符号
     * @param index 指数
     */
    Symbol(String name, int index) {
        this.name = name;
        this.index = index;
    }

    public static String getName(int index) {
        for (Symbol c : Symbol.values()) {
            if (c.getIndex() == index) {
                return c.name;
            }
        }
        return null;
    }

    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public int getIndex() {
        return index;
    }
    public void setIndex(int index) {
        this.index = index;
    }
}
